package com.dexing.niuke;

public class PersonDemo {
    public static void main(String[] args) {
        /*Person p1 = new Person("x", 10);
        Person p2 = getPerson(p1);
        System.out.println(p2);
        System.out.println(p1);*/


    }

    public static Person getPerson(Person person) {
        person.setAge(18);
        person = new Person("小孩", 30);
        return person;
    }

    static class Person{
        @Override
        public String toString() {
            return "Person{" +
                    "name='" + name + '\'' +
                    ", age=" + age +
                    '}';
        }

        public Person(String name, Integer age) {
            this.name = name;
            this.age = age;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public Integer getAge() {
            return age;
        }

        public void setAge(Integer age) {
            this.age = age;
        }

        private String name;
        private Integer age;
    }
}
